package com.xhwl.centiotdata.integration;

import org.apache.commons.lang3.StringUtils;

import java.util.LinkedList;
import java.util.List;

/**
 * Falcon.cao @Copyright (C), 2022, 兴海物联
 * Date: 2022/10/4 18:25
 * Description: 包信息
 */
public enum IntegrationCategoryEnum {

    PARKING_GUIDANCE("车位引导系统"),
    SECURITY_PATROLS("巡更系统"),
    VEHICLE_SCHEDULE("车辆调度系统"),
    UNKNOWN("未知系统");

    IntegrationCategoryEnum(String name) {
        this.name = name;
    }

    private final String name;

    public String getName() {
        return name;
    }

    public static IntegrationCategoryEnum onFindingByName(String name) {
        for (IntegrationCategoryEnum value : values()) {
            if (value.name.equals(name)) {
                return value;
            }
        }
        return UNKNOWN;
    }

    public static List<String> onListing(String name) {
        List<String> list = new LinkedList<>();
        for (IntegrationCategoryEnum source : values()) {
            if (StringUtils.isBlank(name) || source.getName().contains(name)) {
                list.add(source.getName());
            }
        }
        return list;
    }
}
